package vip.liux.contracts.models.product;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import vip.liux.contracts.shared.enums.Status;
import vip.liux.contracts.shared.enums.product.DeductStockType;
import vip.liux.contracts.shared.enums.product.ImageType;
import vip.liux.contracts.shared.value.Image;
import vip.liux.contracts.shared.value.Specs;
import vip.liux.domain.entities.auditing.AuditedEntity;

import java.util.List;

@Getter
@Setter
@Entity
@Table(name = "shop_product")
public class Product extends AuditedEntity<Long> {
    /**
     * 商品编号
     */
    @Column(name = "spu", nullable = false, length = 128)
    private String spu;

    /**
     * 三级类目编号
     */
    @Column(name = "cat_no", nullable = false, length = 128)
    private String catNo;

    /**
     * 一级类目编号
     */
    @Column(name = "cat_root_no", nullable = false, length = 128)
    private String catRootNo;

    /**
     * 二级类目编号
     */
    @Column(name = "cat_parent_no", nullable = false, length = 128)
    private String catParentNo;

    /**
     * 商品品牌编号
     */
    @Column(name = "brand_no", nullable = false, length = 128)
    private String brandNo;

    /**
     * 商品名称
     */
    @Column(name = "product_name", nullable = false, length = 256)
    private String productName;

    /**
     * 库存总量
     */
    @Column(name = "stock_total", nullable = false)
    private Integer stockTotal;

    /**
     * 库存扣减方式 0-下单扣减 1-付款扣减
     */
    @Column(name = "deduct_stock_type", nullable = false)
    private DeductStockType deductStockType;

    /**
     * 商品图片
     * @see ImageType
     */
    @Column(name = "images")
    private List<Image> images;

    /**
     * 商品规格
     *
     * @see Specs
     */
    @Column(name = "specs", nullable = false)
    private List<Specs> specs;

    /**
     * 商品描述
     */
    @Column(name = "`desc`")
    private String desc;

    /**
     * 商品描述
     */
    @Column(name = "`remark`")
    private String remark;

    /**
     * 状态(0:启用, 1:禁用)
     */
    @Column(name = "status")
    private Status status;

    public void setId(Long id) {
        super.setId(id);
    }
}